package com.gome.oa.handler;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import com.gome.oa.custom.GMBrowser;
import com.gome.oa.dialog.PopupBrowserDialog;
import com.teamdev.jexplorer.Browser;
import com.teamdev.jexplorer.PopupContainer;

/**
 *
 * @author: tang li
 * @date: 2016年8月13日
 * @desc: 
 *
 */
public class WindowPopupContainer implements PopupContainer {
	
	private JFrame mainFrame;
	
	public WindowPopupContainer(JFrame mainFrame) {
		super();
		this.mainFrame = mainFrame;
	}

	@Override
	public void insertBrowser(Browser browser) {
		GMBrowser gmBrowser = new GMBrowser(browser.getContext());
		gmBrowser.navigate(browser.getLocationURL());
		final PopupBrowserDialog popupDialog = new PopupBrowserDialog(mainFrame, gmBrowser);
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				popupDialog.setVisible(true);
			}
		});
	}

}
